package NG::Sys::Cache;
use strict;
use warnings;
use utf8;

my $known_cache = {
	memcached => 'Memcached',
	fastmmap => 'Fastmmap',
	nocache => 'Nocache',
	memory => 'Memory',
};

sub new {
	my ($class,$type,@rest) = @_;
	unless($class = $known_cache->{$type}){
		die "bad cache type '$type'\n";
	}
	my $package = "NG::Sys::Cache::".$class;
	eval "require $package;";
	if($@){
		die $@;
	}
	my $cache = $package->new(@rest);
	$cache->{type} = $type;
	return $cache;
}



1;
